package com.coding.springboot.demo.service;

import com.coding.springboot.demo.entity.TUser;
import com.coding.springboot.demo.repository.TUserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by qince on 2015/7/3.
 */
@Service
@Transactional
public class TUserService {
    @Autowired
    private TUserRepository userRepository;

    public void save(TUser user) {
        this.userRepository.save(user);
    }

    public TUser findById(String id) {
        return this.userRepository.findOne(id);
    }

    public Iterable<TUser> findAll() {
        return this.userRepository.findAll();
    }

    public List<TUser> findAllByName(String name) {
        return this.userRepository.findAllByName(name);
    }
}
